home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / GAMES / ANGBANDUEL / Dump2Sprt / !dmp2spr / !RunImage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1996-03-26  |  10KB  |  460 lines

  1.  >!RunImage
  2. taskname$="Dmp2Spr"
  3. dirname$="<Dmp2Spr$dir>"
  4. iconname$="!Dmp2Spr"
  5. menuname$="Dmp2Spr"
  6. filetype%=&FF9
  7. painflag%=
  8. os3%=
  9. inquire%=
  10. dieonsave%=
  11. datamodified%=
  12. throwback(
  13.  taskid% 8:$taskid%="TASK"
  14. "Wimp_Initialise",200,!taskid%,taskname$ 
  15.  version%,taskhand%
  16.  block% 1024,ibm% 1024,winm% 1024,wblk% 2048
  17. "Hourglass_On"
  18. sprites
  19. templates
  20. initmenus
  21. initwindows
  22. iconid%=
  23. "Hourglass_Off"
  24. pollloop
  25. pollloop
  26. "Wimp_Poll",1,block% 
  27.  reason%
  28.  reason% 
  29.  2 : 
  30. "Wimp_OpenWindow",,block%
  31.  3 : 
  32.  "Wimp_CloseWindow",,block%:
  33.  !block%=save% 
  34. saveclosed
  35.  9 : 
  36. menuclick(block%)
  37.  6 : 
  38. iconclicked(block%!12,block%!16)
  39.  8 : 
  40. keypressed(block%!24)
  41.  17,18:
  42.  7 : 
  43. keypressed(code%)
  44.  code%<>13 
  45. "Wimp_ProcessKey",code%:
  46. "Wimp_GetCaretPosition",,wblk%
  47. 1"  window%=!wblk%:icon%=wblk%!4
  48. 2.  buttons%=4:
  49.  simulate select by default!
  50.  window% 
  51. 4D    
  52.  save% : 
  53. selected(save%,0,-1):
  54. saveok:
  55. selected(save%,0,0)
  56. 5$    
  57. "Wimp_ProcessKey",code%
  58. nagg(nagg$)
  59. "Wimp_ReportError","    "+nagg$,1<<4,taskname$
  60. block%!0=-1
  61. block%!4=0
  62. block%!8=0 : 
  63.  Y DIRECTION
  64. A block%!12=76 : 
  65.  X DIRECTION
  66. block%!16=76
  67. block%!20=&2002
  68. $(block%+24)=iconname$
  69.  "Wimp_CreateIcon",,block% 
  70.  icon%
  71. =icon%
  72. nagg("Error in death throes!"):
  73.  b%=1 
  74.  (b%?fontarray%)>0 
  75. L     
  76.  i%=1 
  77.  (b%?fontarray%)
  78.       
  79. "Font_LoseFont",b%
  80. N        
  81. "Wimp_CloseDown",taskhand%,!taskid%
  82. click_type
  83. c%=block%!8
  84.  c%=4 
  85. select
  86.  c%=2 
  87. popupmenu(
  88.  c%=1 
  89. adjust
  90.  block%!16 
  91. saveack
  92. filedrop
  93. loadack
  94. dataopen
  95. filedrop
  96.  block%!40=&FFF 
  97. checkload(
  98. file(block%+44))
  99. file(where%)
  100. file$=""
  101.  ?where%
  102. file$+=
  103. (?where%)
  104. where%+=1
  105. =file$
  106. initmenus
  107. r"  i%=
  108. initmenu(ibm%,menuname$)
  109. s'  i%=
  110. additem(i%,"Info",0,inf_win%)
  111. t"  i%=
  112. additem(i%,"Quit",-1,-1)
  113. v#  i%=
  114. initmenu(winm%,menuname$)
  115. w'  i%=
  116. additem(i%,"Info",0,inf_win%)
  117. x"  i%=
  118. additem(i%,"Quit",-1,-1)
  119. popupmenu(bar%)
  120.  inquire% 
  121.  "Wimp_GetPointerInfo",,block%
  122. ~2q=!block%:w=block%!4:w%=block%!12:i%=block%!16
  123.  bar% 
  124.  w=96+44*2 
  125.  w+=22
  126.  bar% 
  127.  menu%=ibm% 
  128.  menu%=winm%
  129.  "Wimp_CreateMenu",,menu%,q-64,w
  130. &lastmenu%=menu%:menx%=q-64:meny%=w
  131. templates
  132.  fontarray% 256
  133.  b%=0 
  134.  252 
  135. b%!fontarray%=0
  136.  infb% 540,infi% 200
  137.  autb% 1024,auti% 300
  138.  savb% 512,savi% 400
  139. "Wimp_OpenTemplate",,dirname$+".templates"
  140. :inf_win%=
  141. template("info",infb%,infi%,200,-1,sprites%)
  142. >aut_win%=
  143. template("author_m",autb%,auti%,300,-1,sprites%)
  144. 7save%=
  145. template("save",savb%,savi%,400,-1,sprites%)
  146. "Wimp_CloseTemplate"
  147. template(name$,buf%,ind%,len%,fonts%,sprs%)
  148. "Wimp_LoadTemplate",,buf%,ind%,ind%+len%,fonts%,name$,0
  149. buf%!64=sprs%
  150. "Wimp_CreateWindow",,buf% 
  151.  handle%
  152. =handle%
  153. sprites
  154. sfile$="Sprites"+
  155. suffix
  156.  file%=
  157. (dirname$+"."+sfile$)
  158.  file%=0 
  159. nagg("Can't find spritefile!"):
  160. #file%)+128
  161. #file%
  162.  sprites% S%
  163. sprites%!0=S%
  164. sprites%!8=16
  165. "OS_SpriteOp",9+256,sprites%
  166. "OS_SpriteOp",10+256,sprites%,dirname$+"."+sfile$
  167. select
  168. adjust
  169. openwindow(window%)
  170. !wblk%=window%
  171. "Wimp_GetWindowState",,wblk%
  172. wblk%!28=-1
  173. flags%=wblk%!32
  174.  (flags% 
  175.  1<<16)=0 
  176.   !wblk%=window%
  177. "Wimp_GetWindowInfo",,wblk%
  178. /  mwid%=
  179. read_mode(-1,11)<<
  180. read_mode(-1,4)
  181. /  mhig%=
  182. read_mode(-1,12)<<
  183. read_mode(-1,5)
  184. !  width%=(wblk%!12)-(wblk%!4)
  185. "  height%=(wblk%!16)-(wblk%!8)
  186. "  wblk%!4=mwid% 
  187. 2 - width% 
  188.   wblk%!12=(wblk%!4)+width%
  189. $  wblk%!8=mhig% 
  190. 2 - height% 
  191.   wblk%!16=wblk%!8+height%
  192.   wblk%!28=-1
  193. "Wimp_OpenWindow",,wblk%
  194. pii(window%,icon%,text$)
  195. !wblk%=window%
  196. wblk%!4=icon%
  197. "Wimp_GetIconState",,wblk%
  198. %ot$=$(wblk%!28):$(wblk%!28)=text$
  199. wblk%!8=0
  200. wblk%!12=0
  201.  ot$<>text$ 
  202. "Wimp_SetIconState",,wblk%
  203. contents(window%,icon%)
  204. !wblk%=window%
  205. wblk%!4=icon%
  206. "Wimp_GetIconState",,wblk%
  207. =$(wblk%!28)
  208. closewindow(window%)
  209. !wblk%=window%
  210. "Wimp_CloseWindow",,wblk%
  211. selected(window%,icon%,well%)
  212. !wblk%=window%
  213. wblk%!4=icon%
  214. wblk%!12=1<<21
  215. wblk%!8=(-well%)<<21
  216. "Wimp_SetIconState",,wblk%
  217. menuselection(blk%,menu%)
  218. "Wimp_DecodeMenu",,menu%,blk%,wblk%+64
  219. =$(wblk%+64)
  220. menuclick(brtnd%)
  221. ,  item$=
  222. menuselection(brtnd%,lastmenu%)
  223.  PROCnagg(item$)
  224.  item$ 
  225.  "Quit" : 
  226. @    
  227.  "Info" : 
  228. "Wimp_CreateMenu",,-1:
  229. openwindow(aut_win%)
  230. openwindowxy(window%,x%,y%)
  231. !wblk%=window%
  232. "Wimp_GetWindowState",,wblk%
  233.   !wblk%=window%
  234. "Wimp_GetWindowInfo",,wblk%
  235. !  width%=(wblk%!12)-(wblk%!4)
  236.    hite%=(wblk%!16)-(wblk%!8)
  237.   wblk%!4=x%
  238.   wblk%!12=(wblk%!4)+width%
  239.   wblk%!16=y%
  240.   wblk%!8=(wblk%!16)-hite%
  241.   wblk%!28=-1
  242. "Wimp_OpenWindow",,wblk%
  243. saveclicked(xx%,yy%)
  244. openwindowxy(save%,xx%,yy%)
  245. initwindows
  246. loadack
  247. block%!12=block%!8
  248. block%!16=4
  249.  "Wimp_SendMessage",19,block%,block%!4
  250. saveack
  251. name$=
  252. file(block%+44)
  253. leafname(name$)="" 
  254.  NO FILE NAME!
  255. block%!16=3
  256. "Wimp_SendMessage",17,block%,block%!4
  257. pii(save%,1,name$)
  258. saveok
  259. saveok
  260. closewindow(save%)
  261. "Wimp_CreateMenu",,-1
  262.  filename$=
  263. contents(save%,1)
  264. savefile(filename$)
  265.  dieonsave% 
  266. startdrag(window%,icon%)
  267. solid%=
  268. usedragasprite
  269. block%!0=window%
  270.  "Wimp_GetWindowState",,block%
  271. wx%=block%!4-block%!20
  272. wy%=block%!16-block%!24
  273. block%!4=icon%
  274.  "Wimp_GetIconState",,block%
  275. block%!0=window%
  276. block%!4=5
  277. block%!8+=wx%
  278. block%!12+=wy%
  279. block%!16+=wx%
  280. block%!20+=wy%-2
  281. block%!24=0
  282. block%!28=0
  283. (6block%!32=(
  284. read_mode(-1,11)+1)*2^
  285. read_mode(-1,4)
  286. )6block%!36=(
  287. read_mode(-1,12)+1)*2^
  288. read_mode(-1,5)
  289.  solid% 
  290.   spr$="file_"+
  291. ~filetype%
  292. "DragASprite_Start",%10001010,1,spr$,block%+8
  293.   soliddragon%=
  294.  "Wimp_DragBox",,block%
  295.   soliddragon%=
  296. read_mode(mode%,var%)
  297.  "OS_ReadModeVariable",mode%,var% 
  298.  ,,value%
  299. =value%
  300.  soliddragon% 
  301. "DragASprite_Stop"
  302.  "Wimp_GetPointerInfo",,block%
  303. mx%=block%!0
  304. my%=block%!4
  305. window%=block%!12
  306.  window%<1 
  307. ?'name$=
  308. leafname(
  309. contents(save%,1))
  310. @#block%!0=44+((
  311.  name$ 
  312.  4)+1)*4
  313. block%!16=1
  314. block%!20=window%
  315. block%!24=-1
  316. block%!28=mx%
  317. block%!32=my%
  318. block%!36=&100
  319. block%!40=filetype%
  320. $(block%+44)=name$+
  321.  "Wimp_SendMessage",17,block%,window%
  322. leafname(name$)
  323. leaf$=""
  324.  name$<>"" 
  325. name$,1)<>"."
  326.   leaf$=
  327. name$,1)+leaf$
  328.   name$=
  329. name$)
  330. =leaf$
  331. pad(num%)
  332. "   "+
  333. (num%),4)
  334. "OS_Module",20,0,-1 
  335.  ,,,name$,,,v%
  336. Y,=(name$="UtilityModule" 
  337.  v%>=&30000)<>0
  338. usedragasprite
  339. "OS_Byte",161,&1C 
  340.  ,,value%
  341. =(value% 
  342.  2)<>0 
  343.  os3%
  344. filedrag
  345. startdrag(save%,2)
  346. dataopen
  347. checkload(name$)
  348. loadfile(name$)
  349. open(window%)
  350. !wblk%=window%
  351. "Wimp_GetWindowState",,wblk%
  352. wblk%!28=-1
  353. flags%=wblk%!32
  354. =(flags% 
  355.  1<<16)<>0
  356. caretto(win%,icn%)
  357. s   l%=
  358. contents(win%,icn%))
  359. open(win%) 
  360. "Wimp_SetCaretPosition",win%,icn%,-1,-1,-1,l%
  361. updatewindow(window%)
  362. "Wimp_ForceRedraw",window%,0,-1E9,1E9,0
  363. OS_ReadVarVal(A$)
  364.  "OS_ReadVarVal",A$,block%,128,0,3 
  365.  ,,L :A$=""
  366.  a= 0 
  367. A$=A$+
  368. (block%!a)
  369. iconclicked(window%,icon%)
  370. buttons%=block%!8
  371.  window%<0 
  372.  icon%=iconid% 
  373. click_type:
  374.  (block%!8)=2 
  375.  window%=-2 
  376. popupmenu(icon%=iconid%):
  377.  window% 
  378.  save% : 
  379.  icon% 
  380. &    
  381.  2 : 
  382.  buttons%>=16 
  383. filedrag
  384.  0 : 
  385. saveok
  386. .    
  387.  3 : 
  388. closewindow(save%):dieonsave%=
  389.  aut_win% : 
  390.  icon%=14 
  391. closewindow(aut_win%)
  392.  inf_win% : 
  393.  icon%=2 
  394. "Wimp_CreateMenu",,-1:
  395. openwindow(aut_win%)
  396. initmenu(menu%,menuname$)
  397. 2$menu%=menuname$:               : 
  398.  menu title
  399. Emenu%?12=7:menu%?13=2           : 
  400.  title foreground & background
  401. Emenu%?14=7:menu%?15=0           : 
  402.  menu  foreground & background
  403. (menuname$)>5 
  404. "  menu%!16=(
  405. (menuname$)+1)*16
  406.   menu%!16=6*16
  407. 2menu%!20=44        : 
  408.  width & height of items
  409. @menu%!24=0                      : 
  410.  vertical gap twixt items
  411. =menu%+28
  412. additem(menu%,text$,last%,sub%)
  413.  last% 
  414.  !menu%=128 
  415.  !menu%=0
  416. menu%!4=sub%
  417. menu%!8=&7000021
  418. $(menu%+12)=text$
  419. =menu%+24
  420. suffix
  421. "OS_ReadModeVariable",-1,4 
  422.  ,,xeig%
  423. "OS_ReadModeVariable",-1,5 
  424.  ,,yeig%
  425. "OS_ReadModeVariable",-1,0 
  426.  ,,flags%
  427.  xeig%=yeig% 
  428.  suffix$="22" 
  429.  suffix$="24"
  430.  flags% 
  431.  1<<4 
  432.  suffix$="23"
  433. =suffix$
  434. throwback(err$,line)
  435. "DDEUtils_ThrowbackStart"
  436. "DDEUtils_ThrowbackSend",1,,dirname$+".!RunImage"+
  437. 0,line,2,err$+
  438. "DDEUtils_ThrowbackEnd"
  439. savebox(a$)
  440.    A=
  441.  A=0 
  442. nagg("There was an error. The dump could not be spritified!"):
  443.  A,B,C
  444. openwindowxy(save%,A-96,B+64)
  445.    savefrom$=a$
  446. savefile(a$)
  447. copysave(a$) : 
  448. "RENAME "+savefrom$+" "+a$
  449. copysave(a$)
  450. nagg("Can't save as '"+a$+"'."):
  451. "REMOVE "+savefrom$:
  452. "Copy "+savefrom$+" "+a$+" ~C~V~R~NF"
  453. "REMOVE "+savefrom$
  454. loadfile(name$)
  455. pii(save%,1,
  456. leafname(name$))
  457. ^  cli$="/<dmp2spr$dir>.dmp2spr <angband$dir>.lib.xtra.choices <wimp$scrapdir>.Dump "+name$
  458. "Wimp_StartTask",cli$
  459. savebox("<wimp$scrapdir>.Dump")
  460.